--
-- PostgreSQL database dump
--

-- Dumped from database version 8.4.14
-- Dumped by pg_dump version 9.1.9
-- Started on 2013-06-10 17:45:20 VET

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 487 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_with_oids = false;

--
-- TOC entry 140 (class 1259 OID 16396)
-- Dependencies: 3
-- Name: caja; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE caja (
    id_caja character(25) NOT NULL,
    status_caja character(10),
    moentoefectivo_caja double precision NOT NULL
);


ALTER TABLE public.caja OWNER TO postgres;

--
-- TOC entry 141 (class 1259 OID 16399)
-- Dependencies: 3
-- Name: cliente; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE cliente (
    id_clien character(25) NOT NULL,
    nombre_clien character(50),
    telefono_clien character(20),
    correo_clien character(80),
    rif_clien character(25),
    status_clien character(10)
);


ALTER TABLE public.cliente OWNER TO postgres;

--
-- TOC entry 142 (class 1259 OID 16402)
-- Dependencies: 3
-- Name: compra; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE compra (
    id_compr character(50) NOT NULL,
    fecha_compr date,
    idproveedor_compr character(25) NOT NULL
);


ALTER TABLE public.compra OWNER TO postgres;

--
-- TOC entry 143 (class 1259 OID 16405)
-- Dependencies: 3
-- Name: detallecompra; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE detallecompra (
    idcompra_dtcom character(50) NOT NULL,
    idproducto_dtcom character(50),
    fecha_dtcom date,
    cantidad_dtcom integer
);


ALTER TABLE public.detallecompra OWNER TO postgres;

--
-- TOC entry 144 (class 1259 OID 16408)
-- Dependencies: 3
-- Name: detallventa; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE detallventa (
    idventa_deven character(50) NOT NULL,
    idproducto_deven character(50) NOT NULL,
    precioproducto_deven double precision,
    cantidadproducto_deven integer
);


ALTER TABLE public.detallventa OWNER TO postgres;

--
-- TOC entry 145 (class 1259 OID 16411)
-- Dependencies: 3
-- Name: devolucioncompra; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE devolucioncompra (
    idcompra_devco character(50) NOT NULL,
    idproducto_devco character(50) NOT NULL,
    numero_devco character(50) NOT NULL,
    cantidad_devco integer
);


ALTER TABLE public.devolucioncompra OWNER TO postgres;

--
-- TOC entry 146 (class 1259 OID 16414)
-- Dependencies: 3
-- Name: empleado; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE empleado (
    id_emple character(25) NOT NULL,
    nombre_emple character(50),
    apellido_emple character(50),
    telefono_emple character(20),
    direccion_emple character(80),
    correo_emple character(80),
    status_emple character(10)
);


ALTER TABLE public.empleado OWNER TO postgres;

--
-- TOC entry 147 (class 1259 OID 16417)
-- Dependencies: 3
-- Name: empresa; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE empresa (
    rif_empre character(25) NOT NULL,
    nombre_empre character(50),
    direccion_empre character(80),
    telefono_empre character(80),
    correo_empre character(80)
);


ALTER TABLE public.empresa OWNER TO postgres;

--
-- TOC entry 148 (class 1259 OID 16420)
-- Dependencies: 3
-- Name: movimiento; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE movimiento (
    idcaja_movim character(25) NOT NULL,
    tipo_movim character(10),
    descripcion_movim character(80),
    status_movim character(10),
    fecha_movim date,
    monto_movim double precision
);


ALTER TABLE public.movimiento OWNER TO postgres;

--
-- TOC entry 149 (class 1259 OID 16423)
-- Dependencies: 3
-- Name: producto; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE producto (
    id_produ character(50) NOT NULL,
    descripcion_produ character(100),
    marca_produ character(25),
    status_produ character(10),
    preciocosto_produ double precision,
    precioventa_produ double precision,
    stockmin_produ integer,
    stockmax_produ integer,
    existencia_produ integer
);


ALTER TABLE public.producto OWNER TO postgres;

--
-- TOC entry 150 (class 1259 OID 16426)
-- Dependencies: 3
-- Name: proveedor; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE proveedor (
    id_prove character(25) NOT NULL,
    nombre_prove character(50),
    apellido_prove character(50),
    telefono_prove character(20),
    correo_prove character(80),
    rif_prove character(25),
    status_prove character(10)
);


ALTER TABLE public.proveedor OWNER TO postgres;

--
-- TOC entry 151 (class 1259 OID 16429)
-- Dependencies: 3
-- Name: venta; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE venta (
    id_venta character(50) NOT NULL,
    fecha_venta date,
    iva_venta double precision,
    idcliente_venta character(25) NOT NULL
);


ALTER TABLE public.venta OWNER TO postgres;

--
-- TOC entry 152 (class 1259 OID 16432)
-- Dependencies: 3
-- Name: ventacredito; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE ventacredito (
    idventa_vecre character(50) NOT NULL,
    idproducto_vecre character(50) NOT NULL,
    debe_vecre double precision,
    haber_vecre double precision,
    precioproducto_vecre double precision
);


ALTER TABLE public.ventacredito OWNER TO postgres;

--
-- TOC entry 1847 (class 0 OID 16396)
-- Dependencies: 140 1860
-- Data for Name: caja; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY caja (id_caja, status_caja, moentoefectivo_caja) FROM stdin;
\.


--
-- TOC entry 1848 (class 0 OID 16399)
-- Dependencies: 141 1860
-- Data for Name: cliente; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY cliente (id_clien, nombre_clien, telefono_clien, correo_clien, rif_clien, status_clien) FROM stdin;
1234566                  	jose                                              	\N	\N	\N	\N
222                      	jose                                              	\N	\N	\N	\N
222222                   	jose                                              	\N	\N	\N	\N
3333333333               	jose                                              	\N	\N	\N	\N
3333                     	jose                                              	\N	\N	\N	\N
44444444                 	jose                                              	\N	\N	\N	\N
22                       	maria del carmen                                  	\N	\N	\N	\N
111                      	jose piña                                         	\N	\N	\N	\N
1222                     	jose sanchez                                      	\N	\N	\N	\N
123                      	raiver del carmen bolivar y palacios              	\N	\N	\N	\N
1234                     	raiver del moral trinidad y tobago                	\N	\N	\N	\N
12345                    	ruben del carmen maria y jose                     	\N	\N	\N	\N
123456                   	roberto VI                                        	\N	\N	\N	\N
\.


--
-- TOC entry 1849 (class 0 OID 16402)
-- Dependencies: 142 1860
-- Data for Name: compra; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY compra (id_compr, fecha_compr, idproveedor_compr) FROM stdin;
\.


--
-- TOC entry 1850 (class 0 OID 16405)
-- Dependencies: 143 1860
-- Data for Name: detallecompra; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY detallecompra (idcompra_dtcom, idproducto_dtcom, fecha_dtcom, cantidad_dtcom) FROM stdin;
\.


--
-- TOC entry 1851 (class 0 OID 16408)
-- Dependencies: 144 1860
-- Data for Name: detallventa; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY detallventa (idventa_deven, idproducto_deven, precioproducto_deven, cantidadproducto_deven) FROM stdin;
\.


--
-- TOC entry 1852 (class 0 OID 16411)
-- Dependencies: 145 1860
-- Data for Name: devolucioncompra; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY devolucioncompra (idcompra_devco, idproducto_devco, numero_devco, cantidad_devco) FROM stdin;
\.


--
-- TOC entry 1853 (class 0 OID 16414)
-- Dependencies: 146 1860
-- Data for Name: empleado; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY empleado (id_emple, nombre_emple, apellido_emple, telefono_emple, direccion_emple, correo_emple, status_emple) FROM stdin;
\.


--
-- TOC entry 1854 (class 0 OID 16417)
-- Dependencies: 147 1860
-- Data for Name: empresa; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY empresa (rif_empre, nombre_empre, direccion_empre, telefono_empre, correo_empre) FROM stdin;
\.


--
-- TOC entry 1855 (class 0 OID 16420)
-- Dependencies: 148 1860
-- Data for Name: movimiento; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY movimiento (idcaja_movim, tipo_movim, descripcion_movim, status_movim, fecha_movim, monto_movim) FROM stdin;
\.


--
-- TOC entry 1856 (class 0 OID 16423)
-- Dependencies: 149 1860
-- Data for Name: producto; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY producto (id_produ, descripcion_produ, marca_produ, status_produ, preciocosto_produ, precioventa_produ, stockmin_produ, stockmax_produ, existencia_produ) FROM stdin;
1                                                 	Lapiz negro                                                                                         	\N	\N	\N	\N	\N	\N	\N
2                                                 	lapiz azul                                                                                          	\N	\N	\N	\N	\N	\N	\N
3                                                 	lapiz naranja                                                                                       	\N	\N	\N	\N	\N	\N	\N
4                                                 	boligrafo azul                                                                                      	\N	\N	\N	\N	\N	\N	\N
5                                                 	boligrafo negro                                                                                     	\N	\N	\N	\N	\N	\N	\N
6                                                 	boligra rosado                                                                                      	\N	\N	\N	\N	\N	\N	\N
7                                                 	grapadora                                                                                           	\N	\N	\N	\N	\N	\N	\N
\.


--
-- TOC entry 1857 (class 0 OID 16426)
-- Dependencies: 150 1860
-- Data for Name: proveedor; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY proveedor (id_prove, nombre_prove, apellido_prove, telefono_prove, correo_prove, rif_prove, status_prove) FROM stdin;
\.


--
-- TOC entry 1858 (class 0 OID 16429)
-- Dependencies: 151 1860
-- Data for Name: venta; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY venta (id_venta, fecha_venta, iva_venta, idcliente_venta) FROM stdin;
\.


--
-- TOC entry 1859 (class 0 OID 16432)
-- Dependencies: 152 1860
-- Data for Name: ventacredito; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY ventacredito (idventa_vecre, idproducto_vecre, debe_vecre, haber_vecre, precioproducto_vecre) FROM stdin;
\.


--
-- TOC entry 1819 (class 2606 OID 16509)
-- Dependencies: 140 140 1861
-- Name: caja_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY caja
    ADD CONSTRAINT caja_pkey PRIMARY KEY (id_caja);


--
-- TOC entry 1821 (class 2606 OID 16438)
-- Dependencies: 141 141 1861
-- Name: cliente_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY cliente
    ADD CONSTRAINT cliente_pkey PRIMARY KEY (id_clien);


--
-- TOC entry 1823 (class 2606 OID 16440)
-- Dependencies: 142 142 1861
-- Name: compra_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY compra
    ADD CONSTRAINT compra_pkey PRIMARY KEY (id_compr);


--
-- TOC entry 1825 (class 2606 OID 16483)
-- Dependencies: 145 145 1861
-- Name: devolucioncompra_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY devolucioncompra
    ADD CONSTRAINT devolucioncompra_pkey PRIMARY KEY (numero_devco);


--
-- TOC entry 1827 (class 2606 OID 16495)
-- Dependencies: 146 146 1861
-- Name: empleado_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY empleado
    ADD CONSTRAINT empleado_pkey PRIMARY KEY (id_emple);


--
-- TOC entry 1829 (class 2606 OID 16497)
-- Dependencies: 147 147 1861
-- Name: empresa_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY empresa
    ADD CONSTRAINT empresa_pkey PRIMARY KEY (rif_empre);


--
-- TOC entry 1831 (class 2606 OID 16442)
-- Dependencies: 149 149 1861
-- Name: producto_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY producto
    ADD CONSTRAINT producto_pkey PRIMARY KEY (id_produ);


--
-- TOC entry 1833 (class 2606 OID 16444)
-- Dependencies: 150 150 1861
-- Name: proveedor_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY proveedor
    ADD CONSTRAINT proveedor_pkey PRIMARY KEY (id_prove);


--
-- TOC entry 1835 (class 2606 OID 16466)
-- Dependencies: 151 151 1861
-- Name: venta_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY venta
    ADD CONSTRAINT venta_pkey PRIMARY KEY (id_venta);


--
-- TOC entry 1836 (class 2606 OID 16445)
-- Dependencies: 142 150 1832 1861
-- Name: compra_idproveedor_compr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY compra
    ADD CONSTRAINT compra_idproveedor_compr_fkey FOREIGN KEY (idproveedor_compr) REFERENCES proveedor(id_prove);


--
-- TOC entry 1837 (class 2606 OID 16450)
-- Dependencies: 142 1822 143 1861
-- Name: detallecompra_idcompra_dtcom_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY detallecompra
    ADD CONSTRAINT detallecompra_idcompra_dtcom_fkey FOREIGN KEY (idcompra_dtcom) REFERENCES compra(id_compr);


--
-- TOC entry 1838 (class 2606 OID 16455)
-- Dependencies: 1830 149 143 1861
-- Name: detallecompra_idproducto_dtcom_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY detallecompra
    ADD CONSTRAINT detallecompra_idproducto_dtcom_fkey FOREIGN KEY (idproducto_dtcom) REFERENCES producto(id_produ);


--
-- TOC entry 1839 (class 2606 OID 16472)
-- Dependencies: 144 149 1830 1861
-- Name: detallventa_idproducto_deven_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY detallventa
    ADD CONSTRAINT detallventa_idproducto_deven_fkey FOREIGN KEY (idproducto_deven) REFERENCES producto(id_produ);


--
-- TOC entry 1840 (class 2606 OID 16477)
-- Dependencies: 1834 144 151 1861
-- Name: detallventa_idventa_deven_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY detallventa
    ADD CONSTRAINT detallventa_idventa_deven_fkey FOREIGN KEY (idventa_deven) REFERENCES venta(id_venta);


--
-- TOC entry 1841 (class 2606 OID 16484)
-- Dependencies: 1822 145 142 1861
-- Name: devolucioncompra_idcompra_devco_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY devolucioncompra
    ADD CONSTRAINT devolucioncompra_idcompra_devco_fkey FOREIGN KEY (idcompra_devco) REFERENCES compra(id_compr);


--
-- TOC entry 1842 (class 2606 OID 16489)
-- Dependencies: 1830 145 149 1861
-- Name: devolucioncompra_idproducto_devco_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY devolucioncompra
    ADD CONSTRAINT devolucioncompra_idproducto_devco_fkey FOREIGN KEY (idproducto_devco) REFERENCES producto(id_produ);


--
-- TOC entry 1843 (class 2606 OID 16510)
-- Dependencies: 148 140 1818 1861
-- Name: movimiento_idcaja_movim_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY movimiento
    ADD CONSTRAINT movimiento_idcaja_movim_fkey FOREIGN KEY (idcaja_movim) REFERENCES caja(id_caja);


--
-- TOC entry 1844 (class 2606 OID 16467)
-- Dependencies: 151 141 1820 1861
-- Name: venta_idcliente_venta_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY venta
    ADD CONSTRAINT venta_idcliente_venta_fkey FOREIGN KEY (idcliente_venta) REFERENCES cliente(id_clien);


--
-- TOC entry 1846 (class 2606 OID 16503)
-- Dependencies: 152 149 1830 1861
-- Name: ventacredito_idproducto_vecre_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY ventacredito
    ADD CONSTRAINT ventacredito_idproducto_vecre_fkey FOREIGN KEY (idproducto_vecre) REFERENCES producto(id_produ);


--
-- TOC entry 1845 (class 2606 OID 16498)
-- Dependencies: 152 151 1834 1861
-- Name: ventacredito_idventa_vecre_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY ventacredito
    ADD CONSTRAINT ventacredito_idventa_vecre_fkey FOREIGN KEY (idventa_vecre) REFERENCES venta(id_venta);


--
-- TOC entry 1866 (class 0 OID 0)
-- Dependencies: 3
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2013-06-10 17:45:20 VET

--
-- PostgreSQL database dump complete
--

